﻿<Window x:Class="WIAssistant.ManualMapping"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="ManualMapping" Height="700" Width="1200" 
    xmlns:System="clr-namespace:System;assembly=mscorlib" 
    xmlns:DragDrop="clr-namespace:FluidKit.Helpers.DragDrop;assembly=FluidKit"
    Background="#E9ECFA" FontSize="14" 
    Icon="/WIAssistant;component/WIAssistant.ico">
    <!--  , diagnostics:PresentationTraceSources.TraceLevel=High -->
    
    <Window.Resources>
        <DataTemplate x:Key="WorkItemCard"
					  DataType="{x:Type System:String}">
            <Border x:Name="ElementVisual"
					Background="White"
					Padding="5"
					BorderThickness="5"
					BorderBrush="LightGray"
					Grid.Row="0">
                <TextBox FontSize="20" Text="{Binding Title}"/>
            </Border>
        </DataTemplate>
    </Window.Resources>

    <Grid>
        <Grid>
            <Grid.RowDefinitions>
                <!--<RowDefinition Height="200"/>-->
                <RowDefinition Height="Auto" />
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width=".75*"/>
                <ColumnDefinition Width="1.25*"/>
                <ColumnDefinition Width="3*"/>
            </Grid.ColumnDefinitions>
            <!--<fk:ElementFlow Grid.ColumnSpan="2" ItemsSource="{Binding WorkItems}" Name="WorkItemFlow" ItemTemplate="{DynamicResource WorkItemCard}">
            <fk:ElementFlow.Layout>
                <fk:CoverFlow />
            </fk:ElementFlow.Layout>
            <fk:ElementFlow.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#ACBCD1" />
                    <GradientStop Color="#E9ECFA" Offset="0.5" />
                    <GradientStop Color="#ACBCD1" Offset="1" />    
                </LinearGradientBrush>
            </fk:ElementFlow.Background>
            <fk:ElementFlow.Camera>
                <PerspectiveCamera FieldOfView="60" Position="0,3,6" LookDirection="0,-3,-6" />
            </fk:ElementFlow.Camera>
        </fk:ElementFlow>-->


            <TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" >Source Fields</TextBlock>
            <TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" >Mapped Destination Fields</TextBlock>
            <TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" >All Destination Fields</TextBlock>

            <ScrollViewer Grid.Row="1" Grid.ColumnSpan="2">
                <ItemsControl Background="Transparent" ItemsSource="{Binding Mapping.AllSourceFields}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="1*"/>
                                    <ColumnDefinition Width="2*"/>
                                </Grid.ColumnDefinitions>
                                <ContentControl Grid.Column="0" Content="{Binding}"></ContentControl>

                                <Border Grid.Column="1" MinWidth="60" MinHeight="70" BorderBrush="Black" BorderThickness="1">
                                    <WrapPanel Initialized="DropPanel_Initialized"  Background="Transparent" AllowDrop="True" 
                                       DragDrop:DragDropManager.DropTargetAdvisor="{Binding DropTarget}"
                                       DragDrop:DragDropManager.DragSourceAdvisor="{Binding DragSource}"/>
                                </Border>

                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>

            <ScrollViewer Grid.Row="1" Grid.Column="2">
                <ItemsControl ItemsSource="{Binding Mapping.AllDestFields}" Background="Transparent" 
                      DragDrop:DragDropManager.DropTargetAdvisor="{Binding Mapping.DropFromMatch}" 
                      ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Auto">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <ContentControl Background="MediumVioletRed"  DragDrop:DragDropManager.DragSourceAdvisor="{Binding DragFromPile}"                                    
                                    Content="{Binding}"></ContentControl>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>



        </Grid>

        <!--Error message-->
        <Border Height="100" BorderBrush="Black" BorderThickness="2" CornerRadius="10" Background="PaleVioletRed" 
                HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding Mapping.ErrorVisibility}">
            <TextBlock Margin="10"  HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="17" FontWeight="Bold">Data Types Do Not Match</TextBlock>
            
        </Border>
        

    </Grid>

</Window>
